package com.xinhua.wuye.view;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

import com.xinhua.wuye.bean.Bill;
import com.xinhua.wuye.bean.Manager;
import com.xinhua.wuye.dao.BillDAO;
import com.xinhua.wuye.dao.ManagerDAO;
import com.xinhua.wuye.dao.RecordDAO;

public class Menu {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		ManagerDAO mDao = new ManagerDAO();
		BillDAO bDao = new BillDAO();
		RecordDAO rDao = new RecordDAO();
		
		
		System.out.println("请输入id跟密码");
		String id = sc.next();
		String password = sc.next();
		Manager manager = mDao.loginCheck(id, password);
		if(manager==null) {
			System.out.println("错，拜拜");
			System.exit(0);
		}else {
			System.out.println("==== 物业抢钱系统 ====");
			while(true) {
				System.out.println("1. 查看所有账单  2.按住户查账单 3.添加账单 4.查看交费记录 5.按住户查询交费记录 6.添加交费记录");
				int input = sc.nextInt();
				if(input == 1) {
					List<Bill> bills = bDao.getBills();
					for(Bill b:bills) {
						System.out.println(b);
					}
				}else if(input == 2) {
					System.out.println("请输入要查询的住户的id");
					id = sc.next();
					List<Bill> bills = bDao.getBillByResidentId(id);
					for(Bill b:bills) {
						System.out.println(b);
					}
				}else if(input == 3) {
					
					Map<String,Double> fee = new HashMap<>();
					System.out.println("请输入水费：");
					fee.put("水费", sc.nextDouble());
					System.out.println("请输入电费：");
					fee.put("电费", sc.nextDouble());
					System.out.println("请输入物业费：");
					fee.put("物业费", sc.nextDouble());
					System.out.println("请输入账单号：");
					String billId = sc.next();
					System.out.println("请输入账单用户id：");
					String resdentId = sc.next();
					System.out.println("请输入日期：");
					String date = sc.next();
					Bill b = new Bill(billId, resdentId, date, fee);
					
				}else if(input == 4) {
					
				}else if(input == 5) {
					
				}else {
					
				}
					
			}
		}
		
		
	}
}
